<?php

namespace App\Services;
use APP\Libraries\Tool;
class BusinessService
{
    public function enterprise_list($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['capital']=$arr_page[$a]->total_money;
                $array[$a]['name']=$arr_page[$a]->title;
                $array[$a]['type']=$arr_page[$a]->identity;
                $array[$a]['state']=$arr_page[$a]->islocked;
                $array[$a]['additional']['address']=$arr_page[$a]->lx_place;
                $array[$a]['additional']['code']=$arr_page[$a]->zj_credit_code;
                $array[$a]['additional']['contacts']=$arr_page[$a]->lx_contacts;
                $array[$a]['additional']['registere']=$arr_page[$a]->zj_place;
                $array[$a]['additional']['tel']=$arr_page[$a]->lx_mobile;
                $array[$a]['additional']['term']=explode('-',$arr_page[$a]->zj_term);
                $array[$a]['createat']=$Tool->datas(2,$arr_page[$a]->created_at);
            }
        }
        return $array;
    }

    public function enterprise_operation_sub($input)
    {
        $Tool = new Tool();
        $date =$Tool->datas(1,'');
        $array['ic']=getfirstic();
        $array['title'] = $input['name'];
        $array['islocked'] = $input['state'];
        $array['identity'] = $input['type'];
        $array['secret_keys'] = $Tool->jiami(36);
        $array['created_at'] = $date;
        $name_count=$Tool->index_field_exis('shopers','title',$array['title']);
        if ($name_count>0){
            return $Tool->operation(20001,'企业名称重复');
        }
        return $Tool->mysql_insert('shopers',$array);
    }

    public function goods_classif_operation_sub($input)
    {
        $Tool = new Tool();
        $date =$Tool->datas(1,'');
        $array['name'] = $input['label'];
        $array['islocked'] = $input['state'];
        if ($input['ic']){//编辑
            if($input['state']==1){//关闭
                $Tool->mysql_where_edit('shopers_goods','goods_classify_ic',$input['ic'],['upper_shelf'=>'down']);
            }
            $array['updated_at'] = $date;
            $Tool->mysql_edit('goods_classifys',$input['ic'],$array);
            return 'new';
        }else {//新建
            $array['ic']=getfirstic();
            $array['created_at'] = $date;
            $Tool->mysql_insert('goods_classifys',$array);
            return 'new';
        }
    }

    public function goods_classif_index($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['value']=$arr_page[$a]->ic;
                $array[$a]['label']=$arr_page[$a]->name;
                $array[$a]['state']=$arr_page[$a]->islocked;
                $array[$a]['createat']=$Tool->datas(2,$arr_page[$a]->created_at);
            }
        }
        return $array;
    }

    public function goods_operation_sub($ic,$input)
    {
        $Tool = new Tool();
        $date =$Tool->datas(1,'');
        $array=array();//商品数组
        $specifications=array();//商品规格数组
        $array['name']=$input['name'];//商品名称
        $array['supply_shoper_ic']=$input['business_ic'];//供应商
        $array['goods_classify_ic']=implode('/',$input['classifyIc']);//商品分类
        $array['item_number']=$input['good_number'];//货号
        $array['describe']=$input['describe'];//描述
        $array['upper_shelf']=$input['show_state'];//状态
        $array['recommend']=implode('/',$input['label']);//标签
        $array['master_graph']=implode('-',$input['cover_image']);//主图
        $array['details']=$input['textarea'];//详情
        $array['after_sale']=implode('/',$input['after_sale']);//售后
        if ($ic!=''){//编辑
            $array['updated_at'] = $date;
            $Tool->mysql_edit('shopers_goods',$ic,$array);
            $Tool->mysql_del_true('shopers_goods_specs','shopers_goods_ic',$ic);
            for ($a=0;$a<count($input['specifications_arr']);$a++){
                $specifications[$a]['ic']=getfirstic();
                $specifications[$a]['shopers_goods_ic']=$ic;
                $specifications[$a]['name']=$input['specifications_arr'][$a]['name'];//规格名称
                $specifications[$a]['picture']=implode('/',$input['specifications_arr'][$a]['images']);//图片
                $specifications[$a]['factory_price']=$input['specifications_arr'][$a]['factory_price'];//出厂价格
                $specifications[$a]['supply_price']=$input['specifications_arr'][$a]['supply_price'];//供应价格
                $specifications[$a]['retail_price']=$input['specifications_arr'][$a]['retail_price'];//建议价格
                $specifications[$a]['stock']=$input['specifications_arr'][$a]['stock'];//库存
                $specifications[$a]['item_number']=$input['specifications_arr'][$a]['code'];//货号
                $specifications[$a]['created_at'] = $date;
                $Tool->mysql_insert('shopers_goods_specs',$specifications[$a]);
            }
//            $specifications=array();
//            for ($a=0;$a<count($input['specifications_arr']);$a++){
//                //判断价格是否变动，写入操作日志：出厂、供应、建议
//                $log=array();
//                $key=array();
//                $log['ic']=getfirstic();
//                $log['operator']=$Libs->jwts()->ic;
//                $log['s_g_s_ic']=$ic;
//                $log['created_at'] = $date;
//                if (!isset($input['specifications_arr'][$a]['ic'])){
//                    $specifications[$a]['ic']=getfirstic();
//                    $specifications[$a]['shopers_goods_ic']=$ic;
//                    $specifications[$a]['name']=$input['specifications_arr'][$a]['name'];//规格名称
//                    $specifications[$a]['picture']=implode('/',$input['specifications_arr'][$a]['images']);//图片
//                    $specifications[$a]['factory_price']=$input['specifications_arr'][$a]['factory_price'];//出厂价格
//                    $specifications[$a]['supply_price']=$input['specifications_arr'][$a]['supply_price'];//供应价格
//                    $specifications[$a]['retail_price']=$input['specifications_arr'][$a]['retail_price'];//建议价格
//                    $specifications[$a]['stock']=$input['specifications_arr'][$a]['stock'];//库存
//                    $specifications[$a]['item_number']=$input['specifications_arr'][$a]['code'];//货号
//                    $specifications[$a]['created_at'] = $date;
//                    $Libs->mysql_insert('shopers_goods_specs',$specifications[$a]);
//                }else{
//                    $specifications[$a]['name']=$input['specifications_arr'][$a]['name'];//规格名称
//                    $specifications[$a]['picture']=implode('/',$input['specifications_arr'][$a]['images']);//图片
//                    $specifications[$a]['factory_price']=$input['specifications_arr'][$a]['factory_price'];//出厂价格
//                    $specifications[$a]['supply_price']=$input['specifications_arr'][$a]['supply_price'];//供应价格
//                    $specifications[$a]['retail_price']=$input['specifications_arr'][$a]['retail_price'];//建议价格
//                    $specifications[$a]['stock']=$input['specifications_arr'][$a]['stock'];//库存
//                    $specifications[$a]['item_number']=$input['specifications_arr'][$a]['code'];//货号
//                    $specifications[$a]['updated_at'] = $date;
//
//                    $shopers_goods_specs=$Libs->index_first('shopers_goods_specs','ic',$input['specifications_arr'][$a]['ic']);
//                    if ($shopers_goods_specs->factory_price!=$input['specifications_arr'][$a]['factory_price']){//出厂价格
//                        $key[]=$specifications[$a]['name'].'的'.'【出厂价格】'.'由'.$shopers_goods_specs->factory_price.'更改为：'.$input['specifications_arr'][$a]['factory_price'].'元';
//                    }
//                    if ($shopers_goods_specs->supply_price!=$input['specifications_arr'][$a]['supply_price']){//供应价格
//                        $key[]=$specifications[$a]['name'].'的'.'【供应价格】'.'由'.$shopers_goods_specs->supply_price.'更改为：'.$input['specifications_arr'][$a]['supply_price'].'元';
//                    }
//                    if ($shopers_goods_specs->retail_price!=$input['specifications_arr'][$a]['retail_price']){//建议价格
//                        $key[]=$specifications[$a]['name'].'的'.'【建议价格】'.'由'.$shopers_goods_specs->retail_price.'更改为：'.$input['specifications_arr'][$a]['retail_price'].'元';
//                    }
//                    if($key!=[]){
//                        $log['key']=implode('/',$key);
//                        $Libs->mysql_insert('commodity_operation_log',$log);//插入操作日志
//                    }
//                    $Libs->mysql_edit('shopers_goods_specs',$input['specifications_arr'][$a]['ic'],$specifications[$a]);
//                }
//            }
            return 'edit';
        }else{//新建
            $array['ic']=getfirstic();
            $array['created_at'] = $date;
            $Tool->mysql_insert('shopers_goods',$array);
            for ($a=0;$a<count($input['specifications_arr']);$a++){
                $specifications[$a]['ic']=getfirstic();
                $specifications[$a]['shopers_goods_ic']=$array['ic'];
                $specifications[$a]['name']=$input['specifications_arr'][$a]['name'];//规格名称
                $specifications[$a]['picture']=implode('/',$input['specifications_arr'][$a]['images']);//图片
                $specifications[$a]['factory_price']=$input['specifications_arr'][$a]['factory_price'];//出厂价格
                $specifications[$a]['supply_price']=$input['specifications_arr'][$a]['supply_price'];//供应价格
                $specifications[$a]['retail_price']=$input['specifications_arr'][$a]['retail_price'];//建议价格
                $specifications[$a]['stock']=$input['specifications_arr'][$a]['stock'];//库存
                $specifications[$a]['item_number']=$input['specifications_arr'][$a]['code'];//货号
                $specifications[$a]['created_at'] = $date;
                $Tool->mysql_insert('shopers_goods_specs',$specifications[$a]);
            }
            return 'new';
        }
    }

    public function goods_index($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['after_sale']=explode('/',$arr_page[$a]->after_sale);
                $array[$a]['business']=$Tool->index_field('shopers','ic',$arr_page[$a]->supply_shoper_ic,'title');
                $array[$a]['business_ic']=$arr_page[$a]->supply_shoper_ic;
                $array[$a]['classifyIc']=explode('/',$arr_page[$a]->goods_classify_ic);
                for($b=0;$b<count($array[$a]['classifyIc']);$b++){
                    $array[$a]['classifyName'][$b]=$Tool->index_field('goods_classifys','ic',$array[$a]['classifyIc'][$b],'name');
                }
                $array[$a]['cover_image']=explode('-',$arr_page[$a]->master_graph);
                $array[$a]['describe']=$arr_page[$a]->describe;
                $array[$a]['good_identifier']=$arr_page[$a]->ic;
                $array[$a]['good_number']=$arr_page[$a]->item_number;
                $array[$a]['name']=$arr_page[$a]->name;
                $array[$a]['show_state']=$arr_page[$a]->upper_shelf;
                $array[$a]['textarea']=$arr_page[$a]->details;
                $array[$a]['label']=explode('/',$arr_page[$a]->recommend);
                $array[$a]['createat']=$Tool->datas(2,$arr_page[$a]->created_at);
                $array[$a]['specifications_arr']=[];
                $shopers_goods_specs_list=$Tool->index_list('shopers_goods_specs','shopers_goods_ic','=',$arr_page[$a]->ic,'created_at');//规格参数
                for($c=0;$c<count($shopers_goods_specs_list);$c++){
                    $array[$a]['specifications_arr'][$c]['ic']=$shopers_goods_specs_list[$c]->ic;
                    $array[$a]['specifications_arr'][$c]['code']=$shopers_goods_specs_list[$c]->item_number;
                    $array[$a]['specifications_arr'][$c]['factory_price']=$shopers_goods_specs_list[$c]->factory_price;
                    $array[$a]['specifications_arr'][$c]['images']=explode('-',$shopers_goods_specs_list[$c]->picture);
                    $array[$a]['specifications_arr'][$c]['name']=$shopers_goods_specs_list[$c]->name;
                    $array[$a]['specifications_arr'][$c]['retail_price']=$shopers_goods_specs_list[$c]->retail_price;
                    $array[$a]['specifications_arr'][$c]['stock']=$shopers_goods_specs_list[$c]->stock;
                    $array[$a]['specifications_arr'][$c]['supply_price']=$shopers_goods_specs_list[$c]->supply_price;
                }
            }
        }
        return $array;
    }

    public function goods_history_operation($arr_page)//商品编辑 写入操作日志 未完  由于无法测试
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['record']=explode('/',$arr_page[$a]->key);
                $array[$a]['operator']=$Tool->index_field('users','ic',$arr_page[$a]->operator,'nick');
                $array[$a]['createat']=$Tool->datas(2,$arr_page[$a]->created_at);
            }
        }
        return $array;
    }

    public function get_order($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $order_line=[];
                //订单基础详情
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['completion_time']=$Tool->datas(2,$arr_page[$a]->complete_data);//完成时间
                $array[$a]['distributor']=$Tool->index_field('shopers','ic',$arr_page[$a]->sales_ic,'title');//直销商名称
                $array[$a]['in_orderNum']=$arr_page[$a]->ic;//内部编号
                $array[$a]['out_orderNum']=$arr_page[$a]->w_order;//外部编号
                $array[$a]['orderNum']=$arr_page[$a]->order;//订单号
                $array[$a]['order_state']=$arr_page[$a]->order_state;//订单状态 2待预付 3已预付 4已完成 5已关闭
                $array[$a]['supplier']=$Tool->index_field('shopers','ic',$arr_page[$a]->supply_ic,'title');//供应商
                $array[$a]['time_prepaid']=$arr_page[$a]->payment_data;//预付时间
                $array[$a]['total_factory']=$arr_page[$a]->factory_money;//出厂价
                $array[$a]['total_prepaid']=$arr_page[$a]->prepaid_money;//预付总价
                $array[$a]['createat']=$Tool->datas(2,$arr_page[$a]->created_at);
                $array[$a]['completion_time']=$arr_page[$a]->complete_data;
                $order_line[]=['label'=>'创建订单','time'=>$Tool->datas(2,$arr_page[$a]->created_at)];
                //订单图标情况
                if($arr_page[$a]->payment_state==2){//预付状态时间
                    $order_line[]=['label'=>'已预付','time'=>$arr_page[$a]->payment_data];
                }
                if($arr_page[$a]->after_sales_state==2){//售后状态时间
                    $order_line[]=['label'=>'售后','time'=>$arr_page[$a]->after_sales_data];
                }
                if($arr_page[$a]->complete_state==2){//完成状态时间
                    $order_line[]=['label'=>'已完成','time'=>$arr_page[$a]->complete_data];
                }
                $array[$a]['order_box']['order_line']=$order_line;
                //订单商品详情
                $order_details=$Tool->index_list('order_details','order','=',$arr_page[$a]->order,'created_at');//订单商品详情
                $good=array();
                for($b=0;$b<count($order_details);$b++){
                    $good[$b]['express_name']=$order_details[$b]->express_name;//物流名称
                    $good[$b]['express_order']=$order_details[$b]->express_order;//物流编号
                    $goods=$Tool->index_first('shopers_goods','ic',$order_details[$b]->shopers_goods_ic);//商品
                    $specs=$Tool->index_first('shopers_goods_specs','ic',$order_details[$b]->shopers_goods_specs_ic);//规格
                    $good[$b]['goodsName']=$goods->name;//商品名称
                    $good[$b]['goodsNum']=$goods->ic;//商品编号
                    $good[$b]['num']=$order_details[$b]->number;//购买数量
                    $good[$b]['prepaid_price']=$specs->supply_price;//结算价格
                    $good[$b]['factory_price']=$specs->factory_price;//出厂价格
                    $good[$b]['specifications_name']=$specs->name;//规格名称
                }
                $array[$a]['order_box']['order_messages']=$good;
                //物流信息
                $array[$a]['order_box']['order_user']['address']=$arr_page[$a]->place.'  '.$arr_page[$a]->road;
                $array[$a]['order_box']['order_user']['name']=$arr_page[$a]->name;
                $array[$a]['order_box']['order_user']['remarks']=$arr_page[$a]->remarks;
                $array[$a]['order_box']['order_user']['tel']=$arr_page[$a]->phone;
            }
        }
        return $array;
    }

    public function order_export($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['orderNum']=$arr_page[$a]->order;
                $array[$a]['out_orderNum']=$arr_page[$a]->w_order;
                if($arr_page[$a]->order_state==2){
                    $array[$a]['orderState']='待预付';
                }elseif ($arr_page[$a]->order_state==3){
                    $array[$a]['orderState']='已支付';
                }elseif ($arr_page[$a]->order_state==4){
                    $array[$a]['orderState']='已完成';
                }elseif ($arr_page[$a]->order_state==5){
                    $array[$a]['orderState']='已关闭';
                }
                $array[$a]['order_user']=[$arr_page[$a]->name,$arr_page[$a]->phone,$arr_page[$a]->place.$arr_page[$a]->road];
                if($arr_page[$a]->complete_data){
                    $array[$a]['completion_time']=$Tool->datas(3,$arr_page[$a]->complete_data);
                }else{
                    $array[$a]['completion_time']='';
                }
                $array[$a]['time_prepaid']=$Tool->datas(3,$arr_page[$a]->payment_data);
                $array[$a]['distributor']=$Tool->index_field('shopers','ic',$arr_page[$a]->sales_ic,'title');//直销商名称
                $array[$a]['supplier']=$Tool->index_field('shopers','ic',$arr_page[$a]->supply_ic,'title');//直销商名称
                $array[$a]['remarks']=$arr_page[$a]->remarks;

                $order_details=$Tool->index_list('order_details','order','=',$arr_page[$a]->order,'created_at');//订单商品详情
                for($b=0;$b<count($order_details);$b++){
                    $array[$a]['express_name']=$order_details[$b]->express_name;//物流名称
                    $array[$a]['express_order']=$order_details[$b]->express_order;//物流编号
                    $shopers_goods=$Tool->index_first('shopers_goods','ic',$order_details[$b]->shopers_goods_ic);//商品
                    $specs=$Tool->index_first('shopers_goods_specs','ic',$order_details[$b]->shopers_goods_specs_ic);//规格
                    $array[$a]['goodsName']=$shopers_goods->name;//商品名称
                    $array[$a]['goodsNum']=$shopers_goods->ic;//商品编号
                    $array[$a]['num']=$order_details[$b]->number;//购买数量
                    $array[$a]['prepaid_price']=$specs->supply_price;//结算价格
                    $array[$a]['factory_price']=$specs->factory_price;//出厂价格
                    $array[$a]['specificationsName']=$specs->name;//规格名称
                    $array[$a]['specificationsNum']=$specs->ic;//规格名称
                }
            }
        }
        return $array;
    }

    public function get_deliver_list($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['distributor']=$Tool->index_field('shopers','ic',$arr_page[$a]->sales_ic,'title');//直销商名称
                $array[$a]['express_name']=$arr_page[$a]->express_name;//物流名称
                $array[$a]['express_order']=$arr_page[$a]->express_order;//物流编号
                $array[$a]['orderNum']=$arr_page[$a]->order;//订单号
                $array[$a]['out_orderNum']=$arr_page[$a]->w_order;//外部订单号
                $array[$a]['serial']=$arr_page[$a]->ic;//流水号
                $array[$a]['supplier']=$Tool->index_field('shopers','ic',$arr_page[$a]->supply_ic,'title');//供应商
                $array[$a]['time_delivery']=$arr_page[$a]->express_data;//发货时间
            }
        }
        return $array;
    }

    public function get_recharge_list($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $order_line=array();
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['application_number']=$arr_page[$a]->ic;
                $array[$a]['applyTime']=$Tool->datas(2,$arr_page[$a]->created_at);//申请时间
                $array[$a]['distributor']=$Tool->index_field('shopers','ic',$arr_page[$a]->shoper_ic,'title');//销售商
                $array[$a]['money']=$arr_page[$a]->money;
                $array[$a]['order_box']['audit_information']['acceptance']=$arr_page[$a]->recharge_time;//受理时间
                $array[$a]['order_box']['audit_information']['reason']=$arr_page[$a]->reason;//驳回原因
                $array[$a]['order_box']['audit_information']['remarks']=$arr_page[$a]->remarks;//备注
                $array[$a]['order_box']['audit_information']['result']=$arr_page[$a]->state;//状态：1审核中；2驳回；3通过
                $array[$a]['order_box']['invoice']=$arr_page[$a]->invoice_state;//发票类型
                $array[$a]['order_box']['money_order_form']=explode('-',$arr_page[$a]->bill);
                $array[$a]['order_box']['change_type']='sr';
                $order_line[]=['label'=>'创建申请','time'=>$Tool->datas(2,$arr_page[$a]->created_at)];
                if($arr_page[$a]->reason_state==2){//驳回状态时间
                    $order_line[]=['label'=>'驳回','time'=>$arr_page[$a]->reason_data];
                }
                if($arr_page[$a]->adopt_state==2){//通过状态时间
                    $order_line[]=['label'=>'已通过','time'=>$arr_page[$a]->adopt_data];
                }
                $array[$a]['order_box']['order_line']=$order_line;

                $bank['bank_account']=$arr_page[$a]->bank_account;//银行账户
                $bank['bank_name']=$arr_page[$a]->account;//银行名称
                $array[$a]['order_box']['payment_account']=$bank;
            }
        }
        return $array;
    }

    public function goods_extension_operation($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $shoper=$Tool->index_first('shopers','ic',$arr_page[$a]->supply_shoper_ic);
                $array[$a]['business']=$shoper->title;
                $array[$a]['state']=$shoper->islocked;
                $array[$a]['extension_time']=$arr_page[$a]->extension_data;
                $array[$a]['join_time']=$Tool->datas(2,$shoper->created_at);
            }
        }
        return $array;
    }

    public function get_invoice($arr_page)
    {
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $array[$a]['account']=$arr_page[$a]->kh_account;
                $array[$a]['address']=$arr_page[$a]->kh_place;
                $array[$a]['bank']=$arr_page[$a]->kh_opening_bank;
                $array[$a]['code']=$arr_page[$a]->kh_identification_number;
                $array[$a]['name']=$arr_page[$a]->title;
                $array[$a]['tel']=$arr_page[$a]->kh_mobile;
                $array[$a]['type']=$arr_page[$a]->kh_invoice_state;
            }
        }
        return $array;
    }

    public function capital_change_history($arr_page)
    {
        $Tool = new Tool();
        $array=array();
        if($arr_page!=[]){
            for($a=0;$a<count($arr_page);$a++){
                $array[$a]['ic']=$arr_page[$a]->ic;
                $operator = $Tool->index_field('users','ic',$arr_page[$a]->operator,'nick');
                $array[$a]['account']=$operator;
                if($arr_page[$a]->recharge_state==3){//人工充值
                    $array[$a]['change_type']='ar';
                }else{
                    $array[$a]['change_type']='ad';
                }
                $array[$a]['money']=$arr_page[$a]->money;
                $array[$a]['remarks']=$arr_page[$a]->remarks;
                $array[$a]['time']=$arr_page[$a]->recharge_time;
            }
        }
        return $array;
    }

}